package interceptor;

import java.util.Map;

import model.User;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;

public class IfLogin extends AbstractInterceptor {
	public String intercept(ActionInvocation invocation) throws Exception {
		ActionContext act = invocation.getInvocationContext();
		User user = (User) act.getSession().get("user");
		if (user != null) {
			System.out.println("hao");
			return invocation.invoke();
		}
		System.out.println("miss");
		return "index";

	}
}
